texture environmentTexture;

sampler environmentTextureSampler = sampler_state
{
	texture = <environmentTexture>;
};

float4x4 obj2projection;

// -- - --

struct VShaderInput
{
float4 position : POSITION;
};

struct PShaderInput
{
float4 hpos : POSITION;
float3 wpos : TEXCOORD1;
};

// -- - --

PShaderInput vs_environmentmap(VShaderInput input)
{
	PShaderInput result = (PShaderInput)0;
	
	result.hpos = mul (input.position, obj2projection);
	result.wpos = input.position;
	
	return result;
}

float4 ps_environmentmap(PShaderInput input) : COLOR0
{
	return texCUBE ( environmentTextureSampler, input.wpos );
}

// -- - --
technique EnvironmentMap
{
	pass P0
	{
		vertexShader = compile vs_2_0 vs_environmentmap();
		pixelShader = compile ps_2_0 ps_environmentmap();
	}
}
